#include <iostream>
#include <pybind11/pybind11.h>
#include "aclrtlaunch_curr_op.h"
#include <torch/extension.h>
#include "torch_npu/csrc/core/npu/NPUStream.h"
#include "data_utils.h"
#include "custom_tiling.h"
#include "acl/acl.h"

extern void curr_op_do(uint32_t blockDim, void *stream, uint8_t* x, uint8_t* y);

namespace my_op {

void run_curr_op(
  const at::Tensor &x,
  at::Tensor &y)
{
  auto aclStream = c10_npu::getCurrentNPUStream().stream(true);
  ACLRT_LAUNCH_KERNEL(curr_op)(blockDim, aclStream, const_cast<void *>(x.data_ptr()), const_cast<void *>(y.data_ptr()));

  // auto* x_ptr = reinterpret_cast<uint8_t*>(x.data_ptr<at::Half>());
  // auto* y_ptr = reinterpret_cast<uint8_t*>(y.data_ptr<at::Half>());
  // curr_op_do(blockDim, aclStream, x_ptr, y_ptr);
}

}  // namespace my_op

PYBIND11_MODULE(curr_op_py, m) {
  m.doc() = "curr_op bybind11 interfaces";
  m.def("run_curr_op", &my_op::run_curr_op, "");
}
